<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>Vue3</title>
		<link rel="icon" href="https://cn.vuejs.org/logo.svg">
		<link rel="stylesheet" href="index.css">
		<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
	</head>
	<body>
		<div id="view">
			<div class="kd-box">
				<div class="input">
					<input type="text" placeholder="请输入快递单号" v-model="code" />
				</div>
				<div class="btn" @click="search">查询</div>
			</div>
			
			<div class="result" v-show="result">
				<div class="item" v-for="item in result">{{item.AcceptTime}} {{item.AcceptStation}}</div>
			</div>
		</div>
		<script>
			const app = Vue.createApp({
				data() {
					return {
						code: '',
						result: {}
					}
				},
				methods: {
					search() {
						axios({
							url: 'http://localhost:8082/search?code=' + this.code,

						}).then((res) => {
							console.log(res.data.Traces);
							res.data.Traces.sort((item,item2) => item2.AcceptTime.localeCompare(item.AcceptTime))
							this.result = res.data.Traces
						})
					}
				}
			})
			app.mount("#view")
		</script>
	</body>
</html>
